//
//  UILabel+StringFrame.m
//  OMS
//
//  Created by goldeney on 14-10-20.
//  Copyright (c) 2014年 ShangHai Goldeneye Techonology Co.,Ltd. All rights reserved.
//

#import "UILabel+StringFrame.h"

@implementation UILabel (StringFrame)

- (CGSize)boundingRectWithSize:(CGSize)size
{
    NSDictionary *attribute = @{NSFontAttributeName: self.font};
    
    CGSize retSize = [self.text boundingRectWithSize:size options:
                      NSStringDrawingTruncatesLastVisibleLine |
                      NSStringDrawingUsesLineFragmentOrigin |
                      NSStringDrawingUsesFontLeading
                      attributes:attribute context:nil].size;
    
    return retSize;
}

//- (CGSize)boundingRect:(CGSize)size
//{
//    CGSize titleSize = [self.text sizeWithFont:self.font constrainedToSize:CGSizeMake(0, MAXFLOAT)];
//    return titleSize;
//}
//
//- (CGSize)boundingRectWidth
//{
//    CGSize titleSize = [self.text sizeWithFont:self.font constrainedToSize:CGSizeMake(MAXFLOAT, 30)];
//    return titleSize;
//}

@end
